<#import "/admin/common/home.html" as home> 
<#assign css> </#assign> <#assign js> </#assign>
<@home.home pagecss=css pagejs=js>
<div class="main-container">
	<form id="infoSaveForm" action="save" method="post" class="form-horizontal form-dialog-horizontal">
		<div class="panel-dialog-body">
			<#if Session.SESSION_DEFAULT_PWD??>
			<div class="form-group">
				<label class="col-xs-2 control-label"></label>
				<label class="col-xs-6" style="color: red">
					您的密码为初始密码，请您修改密码
				</label>
			</div>
			</#if>
			<div class="form-group">
                <label class="col-xs-2 control-label"><span class="required" aria-required="true">*</span>原密码：</label>
                <div class="col-xs-6">
                	<input type="password" name="oldPassword" value="" id="oldPassword" class="form-control required" maxlength="20" placeholder="请输入您的原密码"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-2 control-label"><span class="required" aria-required="true">*</span>新密码：</label>
                <div class="col-xs-6">
                	<input type="password" name="userPassword" value="" id="userPassword" class="form-control required" maxlength="20" placeholder="请输入您的新密码"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-2 control-label"><span class="required" aria-required="true">*</span>确认密码：</label>
                <div class="col-xs-6">
                	<input type="password" name="userPassword2" value="" id="userPassword2" class="form-control required" maxlength="20" placeholder="请再次输入您的新密码"/>
                </div>
            </div>
            
            <div class="form-group">
            	<div class="col-xs-offset-2 col-xs-7">
					<button id="dialog-btn-save" type="submit" class="btn btn-primary">保存</button>
				</div>
			</div>
    	</div>
    	
	</form>
</div>
</@home.home>
<script type="text/javascript">
	$(function(){
		$("#infoSaveForm").validate({
			rules: {
				userPassword2 : {
				      equalTo: "#userPassword"
			    }
			},
			submitHandler: function(form) {
				var options = {
				  type : "post",
					url : "/admin/sys/pwd/modify",
					dataType:'json',
					beforeSubmit:function(a,b,c){
						load = layer.load(2);
					},
					success : function(data, status) {
						layer.close(load);
						if (data.code == '0') {
							layer.msg(data.msg, { time: 1500 }, function () {
								top.location.reload(); //跳到登录界面去
    						});
						} else {
							layer.msg(data.msg, { time: 1500 });
						}
					}
			  };
			  $(form).ajaxSubmit(options);
			  return false;
			 }
		});
	});
</script>